<template>
	<view>
		<view class="menu-nav">
			<scroll-view scroll-x @scroll="ScrollMenu" class="nav-list">
				<view class="nav" ref="nav" :style="navList.length<=10?'flex-direction:row':''">
					<view class="list" v-for="(item,index) in navList" @click="onSkip(item.id)" :key="item.id">
						<image :src="'/static/nav/nav_ico'+(index+1)+'.png'" mode=""></image>
						<text>{{item.name}}</text>
					</view>
				</view>
			</scroll-view>

			<view class="indicator" v-if="navList.length>10">
				<view class="plan">
					<view class="bar" :style="'left:'+slideNum+'%'"></view>
				</view>
			</view>

		</view>
	</view>
</template>

<script>
	export default {
		name: 'menu-nav',
		components: {},
		data() {
			return {
				navList: [{
						id: 1,
						name: "猜你想丢弃",
					},
					{
						id: 2,
						name: "闲置区域",
					},
					{
						id: 3,
						name: "废品分类",
					},
					{
						id: 4,
						name: "一键下单",
					},
					// {
					// 	id: 5,
					// 	name: "台式电脑",
					// },
					// {
					// 	id: 6,
					// 	name: "珠宝首饰",
					// },
					// {
					// 	id: 7,
					// 	name: "美颜美妆",
					// },
					// {
					// 	id: 8,
					// 	name: "家用电器",
					// },
					// {
					// 	id: 9,
					// 	name: "洗护用品",
					// },
					// {
					// 	id: 10,
					// 	name: "台式电脑",
					// },
				],
			}
		},
		props: {

		},
		computed: {

		},
		methods: {
			// 跳转商品筛选列表
			onSkip(id){
				switch(id){
					case 1:{
						
					}
					case 3:{
						uni.navigateTo({
							url:'/pages/SearchGoodsList/SearchGoodsList'
						})
						break;
					}
				}
				// uni.navigateTo({
				// 	url:'/pages/SearchGoodsList/SearchGoodsList'
				// })
			}
			

		}
	}
</script>

<style scoped lang="scss">
	.menu-nav {
		position: relative;
		width: 90%;
		// height: 300rpx;
		height: 150rpx;
		margin: 30rpx auto;

		.nav-list {
			white-space: nowrap;
			height: 270rpx;
			width: 100%;

			.nav {
				display: inline-block;
				display: flex;
				flex-direction: column;
				flex-wrap: wrap;
				justify-content: space-between;
				height: 270rpx;
			}

			.list {
				display: flex;
				flex-direction: column;
				justify-content: center;
				align-items: center;
				width: 20%;
				height: 130rpx;
				margin-bottom: 20rpx;

				image {
					width: 75rpx;
					height: 75rpx;
					border-radius: 100%;
				}

				text {
					font-size: 26rpx;
					color: #363636;
					margin-top: 10rpx;
				}
			}
		}

		.indicator {
			position: absolute;
			left: 0;
			bottom: 0;
			display: flex;
			justify-content: center;
			align-items: center;
			width: 100%;
			height: 30rpx;

			.plan {
				position: relative;
				width: 100rpx;
				height: 8rpx;
				border-radius: 8rpx;
				background-color: #e1e1e1;

				.bar {
					position: absolute;
					width: 50%;
					height: 100%;
					border-radius: 6rpx;
					// background-color: $base;
					background-color: #FFFFFF;
				}
			}
		}
	}
</style>
